FROM node:20-alpine

# 指定工作目录
WORKDIR /sherry-platfrom-vue3

#复制项目文件
COPY . .

# 安装依赖
RUN pnpm set registry https://registry.npmmirror.com
RUN pnpm install

# 执行构建
RUN cd ./packages/platform
RUN pnpm build

# 使用Nginx作为生产服务器
FROM nginx:alpine

# 从构建阶段复制构建好的文件到Nginx目录
COPY --from=builder /sherry-platfrom-vue3/dist /usr/share/nginx/html

# 暴露80端口
EXPOSE 80

# 启动Nginx
CMD ["nginx", "-g", "daemon off;"]
